import HttpService from '../../app/services/httpService.js';

class CourseService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	CourseListUrl: this.URL + '/course/lists?race_id=',
            CourseCreateUrl: this.URL + '/course/create?race_id=',
            CourseDetailUrl: this.URL + '/course/detail?course_id=',
            CourseUpdateUrl: this.URL + '/course/update?course_id=',
            CourseDelUrl: this.URL + '/course/del?race_id=',
            CourseTeamUrl: this.URL + '/course/courseteam?course_id=',
        }

    }

    /* 科目列表 */
    getCourseList(headers, search) {
        return this.getRequest(this.OBJ.CourseListUrl, headers, search);
    }

    /* 创建科目 */
    postCourseCreate(params, headers, search) {
        return this.postRequest(this.OBJ.CourseCreateUrl, params, headers, search);
    }

    /* 获取科目详情 */
    getCourseDetail(headers, search) {
        return this.getRequest(this.OBJ.CourseDetailUrl, headers, search);
    }

    /* 更新科目 */
    postCourseUpdate(params, headers, search) {
        return this.postRequest(this.OBJ.CourseUpdateUrl, params, headers, search);
    }

    /* 删除科目 */
    postCourseDel(params, headers, search) {
        return this.postRequest(this.OBJ.CourseDelUrl, params, headers, search);
    }

    /* 科目团队列表 */
    getCourseTeam(headers, search) {
        return this.getRequest(this.OBJ.CourseTeamUrl, headers, search);
    }


}

export default CourseService;